export const isImage = (node) => node.type === 'image';
/**
 * Converts "![alt](url)" to "<img src="url" alt="alt">"
 */
export const convertImage = (node) => {
    node.type = 'mdxJsxFlowElement';
    node.name = 'img';
    const attributes = [];
    if (node.url) {
        attributes.push({
            type: 'mdxJsxAttribute',
            name: 'src',
            value: node.url,
        });
    }
    if (node.alt) {
        attributes.push({
            type: 'mdxJsxAttribute',
            name: 'alt',
            value: node.alt,
        });
    }
    if (node.title) {
        attributes.push({
            type: 'mdxJsxAttribute',
            name: 'title',
            value: node.title,
        });
    }
    node.attributes = attributes;
};
